package cn.cloud.controller.admin;

import cn.cloud.service.FastDFSClient;
import cn.cloud.service.user.IUserService;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.File;
import java.io.FileInputStream;

/**
 * Created by Cloud on 2017/9/21.
 *
 * @Description
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private FastDFSClient fastDFSClient;

    @RequestMapping("add")
    @ResponseBody
    public String add() throws Exception{
        File file = new File("d:/bg.jpg");
        String path = fastDFSClient.uploadFile(file);
        System.out.println(path);
        return "ok";
    }
}
